package org.yelongframework.excel.data.collect.sheet.mode.simple;

import org.yelongframework.excel.data.collect.sheet.SheetDataCollectException;
import org.yelongframework.excel.data.collect.sheet.SheetDataCollectMode;
import org.yelongframework.excel.data.collect.sheet.SheetDataCollectScheme;

/**
 * 简单工作表数据收集方案
 * 
 * @since 1.0.0
 */
public class SimpleSheetDataCollectScheme extends SheetDataCollectScheme {

	/** 行索引 */
	private int rowIndex;

	/** 列索引 */
	private int colIndex;

	// ==================================================constructor==================================================

	public SimpleSheetDataCollectScheme() {
		super(SheetDataCollectMode.SIMPLE);
	}

	/**
	 * @param rowIndex    行索引
	 * @param columnIndex 列索引
	 */
	public SimpleSheetDataCollectScheme(int rowIndex, int colIndex) {
		this();
		this.rowIndex = rowIndex;
		this.colIndex = colIndex;

	}

	// ==================================================get/set==================================================

	/**
	 * @return 行索引
	 */
	public int getRowIndex() {
		return rowIndex;
	}

	/**
	 * @param rowIndex 行索引
	 */
	public void setRowIndex(int rowIndex) {
		this.rowIndex = rowIndex;
	}

	/**
	 * @return 列索引
	 */
	public int getColIndex() {
		return colIndex;
	}

	/**
	 * @param colIndex 列索引
	 */
	public void setColIndex(int colIndex) {
		this.colIndex = colIndex;
	}

	// ==================================================校验==================================================

	@Override
	public void check() throws SheetDataCollectException {
		if (rowIndex < 0) {
			throw new SheetDataCollectException("rowIndex不能小于0");
		}
		if (colIndex < 0) {
			throw new SheetDataCollectException("colIndex不能小于0");
		}
	}

}
